<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<s:url id="welcomeUrlId" action="index" namespace="/"></s:url>
<s:url id="loginUrlId" action="loginInput" namespace="/"></s:url>
<s:url id="registerUrlId" action="registerInput" namespace="/"></s:url>
<s:url id="logoutUrlId" action="logout" namespace="/"></s:url>
<s:url id="profileInputUrlId" action="profileInput" namespace="/">
	<s:param name="userId">
		<s:property value="#session.loginToken.userId"></s:property>
	</s:param>
</s:url>
<s:url id="listUserUrlId" action="listUsers" namespace="/"></s:url>
<s:url id="listEventsUrlId" action="listEvents" namespace="/"></s:url>
<s:url id="createEventInputUrlId" action="createEventInput"
	namespace="/"></s:url>

<ul>
	<li><s:a href="%{welcomeUrlId}"><s:text name="menu.index"/></s:a></li>
	<s:if test="#session.loginToken == null">
		<li><s:a href="%{loginUrlId}"><s:text name="menu.login"/></s:a> <br />
		</li>
	</s:if>
	<s:if test="#session.loginToken == null">
		<li><s:a href="%{registerUrlId}"><s:text name="menu.register"/></s:a> <br />
		</li>
	</s:if>
	<s:if
		test="#session.loginToken != null ||
				#session.loginToken.rights.contains('user_list')">

		<li><a href="#nogo"><s:text name="menu.user"/> >></a>
		<ul>
			<s:if test="#session.loginToken != null">
				<li><s:a href="%{profileInputUrlId}"><s:text name="menu.profile"/></s:a> <br />
				</li>
			</s:if>
			<s:if test="#session.loginToken.rights.contains('user_list')">
				<li><s:a href="%{listUserUrlId}"><s:text name="menu.userList"/></s:a> <br />
				</li>
			</s:if>
		</ul>
	</s:if>

	<s:if
		test="#session.loginToken.rights.contains('event_create') ||
				#session.loginToken.rights.contains('event_list')">
		<li><a href="#nogo"><s:text name="menu.events"/> >></a>
		<ul>
			<s:if test="#session.loginToken.rights.contains('event_list')">
				<li><s:a href="%{listEventsUrlId}"><s:text name="menu.eventList"/></s:a> <br />
				</li>
			</s:if>
			<s:if test="#session.loginToken.rights.contains('event_create')">
				<li><s:a href="%{createEventInputUrlId}"><s:text name="menu.eventCreate"/></s:a>
				<br />
				</li>
			</s:if>
		</ul>
		</li>
	</s:if>
	<s:if test="#session.loginToken != null">
		<li><s:a href="%{logoutUrlId}"><s:text name="menu.logout"/></s:a> <br />
		</li>
	</s:if>
</ul>

